ke.create({
	data:{
		admin:{},
		unlockPass:'',
		curr:0,
		currTabs:0,
		tabs:[]
	},
	methods:{
		onTopNav:function(index){
			this.curr = index
		},
		onSidebar:function(item){
			this.httpsrc = item.url
		},
		onCommand:function(type){
			if(type=='editpass'){
				this.maps('adminEditPass')
			}else if(type=='logout'){
				this.$confirm('确定要退出系统吗？',{
					callback:function(type){
						if(type=='confirm'){
							http.get({
								url:vm.map.logout,
								success:function(res){
									if(res===0){
										vm.$alert(res.msg)
									}else{
										vm.maps('login')
									}
								}

							})
						}
					}
				})
			}
		},
		lockScreen:function(type){
			if(type){
				// 锁定
				http.get({
					url:this.map.lockScreen,
					params:{
						type:1
					},
					success:function(res){
						if(res.code===0){
							vm.$message.error(res.msg)
						}else{
							vm.data.isLock=true
						}
					}
				})
			}else{
				// 解锁
				http.post({
					url:this.map.lockScreen,
					params:{
						type:0
					},
					data:{
						pass:this.unlockPass
					},
					success:function(res){
						if(res.code===0){
							vm.$message.error(res.msg)
						}else{
							vm.data.isLock=false
							vm.unlockPass=''
						}
					}
				})
			}

		},
		// 清理缓存
		clearCache:function(){
			var l=this.$loading({
        lock: true,
        text: '清除缓存中',
        background: 'rgba(0, 0, 0, 0.7)'
      })
			http.get({
				url:this.map.clearCache,
				complete:function(){
					l.close()
				},
				success:function(res){
					if(res.code===0){
						vm.$message.error(res.msg)
					}else{
						vm.$message.success(res.msg)
					}
				}
			})
		},
		removeTab:function(d){

		}
	},
	created:function(){
		this.admin = this.data.admin
		this.currTabs++
		this.tabs.push({
			title:'首页',
			name:this.currTabs,
			content:this.map.home
		})
		this.maps('home')
	}
})